<template>
  <div class="patient-info-box">
    <div class="patient-title">患者详情</div>
    <div class="top-info">
      <img
        class="avatar-img"
        :src="info.wbMentalPatientBean.userImg ? this.prefixImg + info.wbMentalPatientBean.userImg : emptyPersonImg"
      />
      <div class="right-info">
        <div class="name-wrapper">
          <div class="r-left">
            <div class="name-class">{{ info.wbMentalPatientBean.name }}</div>
            <div class="level-class">{{ info.wbMentalPatientBean.patientLevel }}级</div>
          </div>
          <!-- <div class="r-right" @click="handleAll">查看全部></div> -->
        </div>
        <div class="info-item">
          <div class="info-label">IMEI码:</div>
          <div class="info-value">{{ info.wbDeviceInfoBean.imei || '暂无' }}</div>
        </div>
        <div class="info-item">
          <div class="info-label">SIM码:</div>
          <div class="info-value">{{ info.wbDeviceInfoBean.simNumber || '暂无' }}</div>
        </div>
        <div class="info-item">
          <div class="info-label">居住地址:</div>
          <div class="info-value">{{ info.wbMentalPatientBean.currentAddress || '暂无' }}</div>
        </div>
      </div>
    </div>
    <div class="center-info">
      <div class="center-item">
        <div class="c-label">心率：</div>
        <div class="c-value">{{ info.heartrate }}（次/分）</div>
      </div>
      <div class="center-item">
        <div class="c-label">血压：</div>
        <div class="c-value">{{ info.dbp }}/{{ info.sbp }}（mmHg）</div>
      </div>
      <div class="center-item">
        <div class="c-label">血氧：</div>
        <div class="c-value">（{{ info.bloodoxygen }}%）</div>
      </div>
      <div class="center-item">
        <div class="c-label">步数：</div>
        <div class="c-value">{{ info.stepValue }}（步）</div>
      </div>
    </div>
    <div class="bottom-info">
      <a-table :columns="careingColumns" :data-source="info.wbHelpInfoList" size="small" :pagination="false"> </a-table>
    </div>
  </div>
</template>

<script>
import { getPrefixImg } from '../../../../utils/util'
import emptyPersonImg from '../../../../assets/imgs/empty-person-img.jpg'

export default {
  props: {
    info: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      emptyPersonImg,
      prefixImg: getPrefixImg(),
      careingColumns: [
        {
          title: '人员类型',
          dataIndex: 'helpPersonTypeText',
          key: 'helpPersonTypeText',
          align: 'left',
        },
        {
          title: '姓名',
          dataIndex: 'helpName',
          key: 'helpName',
          align: 'left',
        },
        {
          title: '联系方式',
          dataIndex: 'helpPhone',
          key: 'helpPhone',
        },
        {
          title: '离线提醒次数',
          dataIndex: 'raceletOfflineCount',
          key: 'raceletOfflineCount',
        },
        {
          title: '吃药提醒次数',
          dataIndex: 'medicationCount',
          key: 'medicationCount',
        },
        {
          title: '回访提醒次数',
          dataIndex: 'visiteCount',
          key: 'visiteCount',
        },
      ],
      careingData: [],
    }
  },
  methods: {
    handleAll() {
      console.log('handleAll')
      this.$router.push({
        path: '/humanisticConcern/patientProfile/detail',
        // query: {
        //   id: this.info.wbMentalPatientBean.id,
        // },
      })
    },
  },
}
</script>

<style lang="less" scoped>
.patient-info-box {
  z-index: 100;
  padding: 14px 22px;
  .patient-title {
    font-weight: 800;
    font-size: 36px;
    color: #00fcff;
    text-align: center;
  }
  .top-info {
    background: rgba(17, 84, 178, 0.8);
    display: flex;
    margin-bottom: 3px;
    padding: 10px 10px 0 10px;
    .avatar-img {
      width: 96px;
      height: 112px;
    }
    .right-info {
      margin-left: 13px;
      flex: 1;
      .name-wrapper {
        display: flex;
        align-items: center;
        justify-content: space-between;
        .r-left {
          display: flex;
          align-items: center;
        }
        .r-right {
          font-weight: 500;
          font-size: 14px;
          color: #00ff96;
          padding-right: 15px;
          cursor: pointer;
        }
        .name-class {
          font-weight: 800;
          font-size: 24px;
          color: #01d8ff;
        }
        .level-class {
          font-weight: 500;
          font-size: 14px;
          color: #f8d100;
          background: rgba(248, 209, 0, 0.4);
          border-radius: 4px;
          border: 1px solid #f8d100;
          opacity: 0.6;
          margin-left: 10px;
          padding: 0px 7px;
        }
      }
      .info-item {
        display: flex;
        font-weight: 500;
        font-size: 14px;
        color: #01d8ff;
        margin-bottom: 5px;
        .info-label {
          width: 70px;
          text-align: right;
        }
        .info-value {
          background: rgba(2, 108, 219, 0.5);
          padding: 5px 0;
          margin-left: 10px;
          padding-left: 3px;
          flex: 1;
          white-space: break-spaces;
          text-align: left;
          padding-left: 4px;
        }
      }
    }
  }
  .center-info {
    padding: 18px 10px;
    background: rgba(17, 84, 178, 0.8);
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 3px;

    .center-item {
      width: 50%;
      display: flex;
      font-weight: 500;
      font-size: 14px;
      color: #01d8ff;
      margin-bottom: 10px;
      &:nth-child(odd) {
        width: calc(50% - 26px);
      }
      &:nth-child(even) {
        padding-left: 26px;
      }
      .c-value {
        background: rgba(2, 108, 219, 0.5);
        flex: 1;
        padding-left: 2px;
        text-align: left;
      }
    }
  }
  .bottom-info {
    background: rgba(17, 84, 178, 0.8);
    padding: 18px 10px;
    /deep/.ant-table-thead {
      > tr {
        > th {
          background: rgba(17, 84, 178, 0.8);
          font-weight: 500;
          font-size: 14px;
          color: #01d8ff;
          border: 0;
        }
      }
    }
    /deep/ .ant-table-tbody {
      > tr {
        margin-bottom: 7px;

        > td {
          border: 0;
          background: rgba(2, 108, 219, 0.5);
          font-weight: 500;
          font-size: 14px;
          color: #01d8ff;
          height: 22px;
          padding: 4px 16px !important;
          padding-left: 8px !important;
        }
      }
    }
    /deep/ .ant-table-small {
      border: 0;
    }
    /deep/ table {
      border-collapse: separate;
      border-spacing: 0 3px;
    }
  }
}
</style>
